package com.itheima.string;

import java.util.Scanner;

public class StringMethod05 {
    /*
    用substring()方法实现字符串的截取
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入手机号:");
        String tel = sc.next();
        //从0索引开始截取,截取到3索引,包含0不包含3,含头不含尾
        String start = tel.substring(0,3);
        //截取后几位,建议用.length()方法先获取字符串长度再减位数就是实际需要的后几位
        String end = tel.substring(tel.length()-4);

        System.out.println(start+"****"+end);
    }
}
